using System;
using UserInterface.Misc;

namespace UserInterface
{
    public partial class DieMessage : BoardPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DieMessageType type = (DieMessageType)Convert.ToByte(Request.QueryString["type"]);
            string resourceKey = (string)Request.QueryString["resourceKey"];
            string redirectUrl = (string)Request.QueryString["redirectUrl"];

            if (redirectUrl != null)
            {
                Response.AppendHeader("Refresh", "3;URL=" + redirectUrl);
            }

            if (type == DieMessageType.Error)
            {
                HeaderTextLiteral.Text = GetLocalResourceObject("ErrorHeader").ToString();
            }
            else if (type == DieMessageType.InsufficientPermissions)
            {
                HeaderTextLiteral.Text = GetLocalResourceObject("InsufficientPermissionsHeader").ToString();
            }
            else if (type == DieMessageType.Information)
            {
                HeaderTextLiteral.Text = GetLocalResourceObject("InformationHeader").ToString();
            }

            MessageTextLiteral.Text = GetLocalResourceObject(resourceKey).ToString();
        }
    }
}
